<%@ page language="java" import="java.util.*,code.bean.*"
	pageEncoding="UTF-8"%>
<%@ page import="code.util.ParamUtils"%>
<%@ page import="code.util.DateUtils"%>
<%@ page import="java.util.Calendar"%>
<%@ page import="code.util.PageObject" %>
<%@ page import = "java.util.HashSet" %>
<%@ page import="java.util.Iterator" %>
<%
	List codes = (List)ParamUtils.getObjectAttribute(request, "codes", null);
	List allShares = (List)ParamUtils.getObjectAttribute(request, "allShares", null);
	String codedate = (String)ParamUtils.getObjectAttribute(request, "codedate", "");
	String language = (String)ParamUtils.getObjectAttribute(request, "language", "");
	Code code = new Code();
	int i;
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<%

	User user = (User)ParamUtils.getObjectAttribute(request, "user", null);

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
		<base href="<%=basePath%>">

		<title>CodeSharer-我的分享</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link href="css/s.css" rel="stylesheet" type="text/css" />
        <link href="css/comment_7.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div id="head">
	<div class="hd">
		<div class="l tac wl2" style="width:720px;padding:3px;">
		<table width="100%"><tr>
			<td><div style="padding-left:15px;"><a href="servlet/ShowIndex1"><img src="images/pcslogo.gif"/></a></div></td>
			<td class="ce" style="font-size:14px">
			&nbsp;<a href="servlet/ShowSpace?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">主页</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowCode?userid=<%=ParamUtils.getParameter(request, "userid", "")%>&blogdate=<%=DateUtils.format(Calendar.getInstance().getTime())%>" class="ce">我的代码</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowShare?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">我的收藏</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowProfile?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">用户信息</a>&nbsp;┊
			&nbsp;<a href="servlet/ManageCode?userid=<%=ParamUtils.getParameter(request, "userid", "")%>&cmd=add" class="ce">发布代码</a>&nbsp;┊
			&nbsp;<a href="../CodeSharer/advSearch.jsp?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">搜索</a>
			
			<%
				if(session.getAttribute("loginUser") != null && ((User)(session.getAttribute("loginUser"))).getId().equals(ParamUtils.getParameter(request, "userid", "")))
			    { 
					out.println("&nbsp;┊&nbsp;<a href=\"servlet/CodeList?userid=" + ParamUtils.getParameter(request, "userid", "") + "\" class=\"ce"+"\">代码管理</a>");
				    out.println("&nbsp;┊&nbsp;<a href=\"servlet/ShareList?userid=" + ParamUtils.getParameter(request, "userid", "") + "\" class=\"ce"+"\">收藏管理</a>");
				    out.println("&nbsp;┊&nbsp;<a href=\"servlet/DoLogout" + "\" class=\"ce"+"\">退出</a>");
				}
			%>
			</td>
		</tr></table>
		</div>
		<div align="right">
			<table>
			<tr>
			<td>
			    <div style="padding:4px;"></div>
				<form name="" action="servlet/SearchCodeByTitle?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" method="post">
				<input type="text" name = "title1" value="" maxlength="15"/>
				<input type="submit" class="signinbtn1" value="搜标题"/>
				</form>
			</td>
			<td>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<%if(session.getAttribute("loginUser") != null){ %>
			<a href="servlet/ShowSpace?userid=<%=
			((User)
			(session.getAttribute
			("loginUser"))).getId()
			%>" class="ce" style="font-size:16px">
			<%=((User)
			(session.getAttribute
			("loginUser"))).getNickName()%>
			</a>
			<%}%>
			</td>
			</tr>
			</table>
		</div>
		<div class="c"></div>
	</div>
</div>

<DIV id=main>
  <DIV style="WIDTH: 230px" class="m1 wl2">

    <DIV class=m1t></DIV>
	       <div style="padding:15px 0 0 15px;">
		
		    <div class="f13 ml20"><span style="font:bold 20px '黑体'; color:#D01E3B;">CodeSharer<br /></span> </div>
		    <div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>

            <div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />这里是帮助你管理你的代码，并与你的朋友、同事、同学一起分享代码的真实平台</div>
	     
			<div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>
						
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码高亮显示</div>
			<div style="padding:2px;"></div>
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码版本控制</div>
			<div style="padding:2px;"></div>
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码分享、收藏、评论</div>
			
			<div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>
			
			<div style="margin:0px 0px 0px 20px">
				<h3 style="font:18px '黑体'; color:#D01E3B;">语言存档</h3>
			        <% 
			        	HashSet hashSet=new HashSet();
			        	for(i = 0; i <allShares.size(); i++){
			        		code = (Code)allShares.get(i);
			        		hashSet.add(code.getLanguage());
			        	}
			        	if(codes.size() > 0 ){
			        		StringBuffer str = new StringBuffer();
			        		Iterator it = hashSet.iterator();
							str.append("<UL>\n\r");
							for(i = 0; i <hashSet.size(); i++){
							 	String s = it.next().toString();
								str.append("<LI><a href=\"servlet/ShowShare?userid=");
								str.append(user.getId());
								str.append("&flag=");
								str.append("1");	
								str.append("&language=");
								str.append(s);
								str.append("\">");
								str.append(s);
								str.append("</a></LI>\n\r");
							}
							str.append("</UL>\n\r");
							out.println(str.toString());
						}
			        %>
			        <div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>
					
			        <h3 style="font:18px '黑体'; color:#D01E3B;">日期存档</h3>
					<%
						String startDate = DateUtils.formatTo(user.getRegDate());
						String currentDate = DateUtils.format(Calendar.getInstance()
								.getTime());
						StringBuffer str = new StringBuffer();
						str.append("<UL>\n\r");
						while (DateUtils.compareTime(startDate, currentDate)) {
							str.append("<LI><a href=\"servlet/ShowShare?userid=");
							str.append(user.getId());
							str.append("&flag=");
							str.append("0");
							str.append("&codedate=");
							str.append(currentDate);
							str.append("\">");
							str.append(currentDate.substring(0, 4));
							str.append("年");
							str.append(currentDate.substring(4, 6));
							str.append("月");
							str.append("</a></LI>\n\r");
							//将当前时间提前一月
							currentDate = DateUtils.roleTime(currentDate, false);
						}
						str.append("</UL>\n\r");
						out.println(str.toString());
					%>
			</div>
		</div>
  </DIV>
  <DIV style="WIDTH: 770px" class="m2 wr2">
<DIV id=r2s_2>
<DIV style="WIDTH: 700px" id=r2l>
<DIV class=c>
		<br />
	

				<div><%@ include file="./partCode.inc"%><br></div>
			
</DIV>
 </DIV>
<DIV class=c></DIV></DIV></DIV>
</DIV>
<DIV id=b>
<DIV class=b1><A class=c6 href="#" target=_blank>关于我们</A><SPAN>┊</SPAN><A class=c6 href="#" target=_blank>联系方式</A><SPAN>┊</SPAN>
<A class=c6 href="#" target=_blank>意见反馈</A><SPAN>┊</SPAN><A class=c6 href="#" target=_blank>帮助中心</A><SPAN>┊</SPAN>
<A class=c6 href="#" target=_blank>NENU</A><SPAN>┊</SPAN> 
<IMG align=absMiddle src="images/gs.gif" width=15>&nbsp;<IMG align=absMiddle src="images/jc.gif" width=17>
</DIV></DIV>
</body>
</html>
